<template>
  <div >
    <XForm v-model="model" :rules="rules" />
    <span style="width: 20px;display: inline-block;"></span>
    <div style="height: 10px;"></div>
    <JGrid ref="jgridRef" show-footer :columns="columns"  :offset-bottom="120" :offset-width="1" show-pager :search-model="model" listUrl="app/py" :page-size="200"></JGrid>
  </div>
</template>

<script setup>
import {ref, onMounted} from "vue";
import tool from "@/utils/tool";
import {useRoute} from "vue-router";
const route = useRoute()
const show = ref(false)
const columns = ref([
  {type: 'index', width: 50},
  {title: '状态', width: 100,field:'stat', align: 'center'},
  {title: '日期', width: 100,field:'ym', align: 'center'},
  {title: '票号', width: 150,field:'billNo', align: 'center'},
  {title: '商品编码', width: 160,field:'invCode', align: 'center'},
  {title: '商品名称', field:'invName', align: 'left', headerAlign: 'center'},
  {title: '终端类型', width: 90,field:'terType', align: 'center'},
  {title: '终端编码', width: 110,field:'buCode', align: 'center'},
  {title: '终端名称', field:'buName', align: 'left', headerAlign: 'center'},
  {title: '数量', width: 100,field:'qty', align: 'right', sum: true,fixed: 'right'},
])
const jgridRef = ref(null)
const username = ref('')
const task = ref('')
const list = ref([])
const model = ref({
  which:'todayTaskDone'
})
const rules = [
  {field: 'beginDate', title: '开始日期', com: 'JPicker', width: 220,clearable: true,placeholder: '开始',defaultValue: tool.getDay()},
  {field: 'endDate', title: '结束日期', com: 'JPicker', width: 220,clearable: true,placeholder: '结束',defaultValue: tool.getDay()},
  {field: 'buName',idField: 'buId', title: '终端', com: 'JAuto', width: 250,cat: 'py_ter',url:'app/py'},
  {field: 'invName',idField: 'invId', title: '商品', com: 'JAuto', width: 250,cat: 'py_good',url:'app/py'},
  {field: '',idField: '',  com: 'JButton', width: 100,text: '查询',icon:'search',
    events: {
      click:() => {
        getList()

      }
    }
  }
]

onMounted(() => {
  username.value = route.query.username
  getList()
})
const getList = () => {
  jgridRef.value.getList()
}



const changeList = () => {
 getList()
}
defineExpose({changeList})
</script>
<style scoped lang="scss">
.sets {
  td{
    padding: 5px;
  }
}
.suc{
  color: green;
}
.err{
  color: red;
}
</style>